package com.example.demo.service;

import com.example.demo.serviceImpl.SchedualServiceHiHystric;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by Administrator on 2018/9/24.
 * 1、定义一个feign接口，通过@ FeignClient（“服务名”），来指定调用哪个服务。
 * 比如在代码中调用了service-hi服务的“/hi”接口
 * 2、实现熔断机制
 * 只需要在FeignClient的SchedualServiceHi接口的注解中加上fallback的指定类
 * 并定义SchedualServiceHiHystric类实现该接口
 */
@FeignClient(value = "SERVICE-HI",fallback = SchedualServiceHiHystric.class)
public interface SchedualServiceHi {

    @RequestMapping(value = "/hi",method = RequestMethod.GET)
    String sayHiFromClientOne(@RequestParam(value = "name") String name);

}
